package com.nuc.zyt.day05.bio;

import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

/**
 * @ClassName HandleSocketServerPool
 * @Description TODO
 * @Author 耀酱
 * @Date 2023/5/31 8:33
 * @Version 1.0
 */

public class HandleSocketServerPool {

    private ExecutorService executorService; // 存储线程池对象

    public HandleSocketServerPool(int maxThreadNum,int queueSize){
        executorService = new ThreadPoolExecutor(3,maxThreadNum,120, TimeUnit.SECONDS,
                new ArrayBlockingQueue<>(queueSize));
    }

    /**
     * 将任务提交给线程池任务队列
     * @param target
     */
    public void execute(Runnable target){
        executorService.execute(target);
    }




}
